﻿using Main.dto;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main.DataBaseContext
{
    public class BusnessContext:DbContext
    {
        public DbSet<ToDoTask> ToDoTasks { get; set; }

        public DbSet<Memo> Memos { get; set; }

        public BusnessContext()
        {
            
            
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            /* 需要引入 nuget 包
             Microsoft.EntityFrameworkCore.SqlServer
             */
            optionsBuilder.UseSqlServer("Server=(local);Integrated Security=SSPI;Initial Catalog=ToDoTask;TrustServerCertificate=true");
                ;

            /* 需要引入 nuget 包
            Microsoft.EntityFrameworkCore.Proxie
             */
            optionsBuilder.UseLazyLoadingProxies();
        }

        
    }
}
